package com.hxd.otc.common.enums;

import com.hxd.otc.R;
import com.hxd.otc.utils.ResourceUtil;

/**
 * Created by lzy on 2018/6/14 0014.
 * description ${收款方式类型}
 */
public enum BankType {
    WEXIN(1, ResourceUtil.getString(R.string.weixin)) {
        @Override
        public int getBankCardLogo() {
            return R.mipmap.icon_my_bankcard_logo_weixin;
        }

        @Override
        public int getSelectPaymentMethodLogo() {
            return R.mipmap.icon_deal_payment_method_wechat;
        }
    },
    ALIPAY(2, ResourceUtil.getString(R.string.alipay)) {
        @Override
        public int getBankCardLogo() {
            return R.mipmap.icon_my_bankcard_logo_alipay;
        }

        @Override
        public int getSelectPaymentMethodLogo() {
            return R.mipmap.icon_deal_payment_method_alipay;
        }
    }, BANK(3, ResourceUtil.getString(R.string.bank_card)) {
        @Override
        public int getBankCardLogo() {
            return R.mipmap.icon_my_bankcard_logo_bankcard;
        }

        @Override
        public int getSelectPaymentMethodLogo() {
            return R.mipmap.icon_deal_payment_methed_bankcard;
        }
    };

    private final int type;
    private final String bankName;

    BankType(int type, String bankName) {
        this.type = type;
        this.bankName = bankName;
    }

    public int getType() {
        return type;
    }

    public String getTypeStr() {
        return String.valueOf(type);
    }

    public String getBankName() {
        return bankName;
    }

    public static BankType getBankTypeByValue(int type) {
        if (type == WEXIN.getType()) {
            return WEXIN;
        } else if (type == ALIPAY.getType()) {
            return ALIPAY;
        } else  {
            return BANK;
        }
    }

    public abstract int getBankCardLogo();

    /**
     * 用于选择收款方式的logo获取
     */
    public abstract int getSelectPaymentMethodLogo();

}
